//
// File:	SdkMain.cpp
// Author:	Thomas TISSOT-DUPONT
// E-mail:	<thomas.tissotdupont@free.fr>
// Create:	27/04/2010 20:59:42
// Purpose:	
//
#include "SDKBase.hpp"
#include "TestEntities.hpp"
#include "BaseGameRule.hpp"
#include "Trace.hpp"

#ifdef WIN32
# define DLL_EXPORT		extern "C" __declspec(dllexport)
#else
# define DLL_EXPORT		extern "C"
#endif

DLL_EXPORT bool SDKMain(GlobalVariables::Pointers &pointers)
{
#ifndef NDEBUG
	Trace::setLevel(Trace::All);
#else
	Trace::setLevel(Trace::None);
#endif

	//Acquire global pointers
	GlobalVariables::Engine::Acquire(pointers.engine);
	GlobalVariables::FactoryManager::Acquire(pointers.factoryManager);
	GlobalVariables::Config::Acquire(pointers.config);
	GlobalVariables::Global::Acquire(pointers.global);
	GlobalVariables::DisplayManager::Acquire(pointers.displayManager);
	GlobalVariables::InputManager::Acquire(pointers.inputManager);
	GlobalVariables::GuiManager::Acquire(pointers.guiManager);
	GlobalVariables::EntityManager::Acquire(pointers.entityManager);
	GlobalVariables::GameRuleManager::Acquire(pointers.gameruleManager);
	GlobalVariables::SoundManager::Acquire(pointers.soundManager);
	GlobalVariables::EventManager::Acquire(pointers.eventManager);

	//Register Entities Classes
	LINK_ENTITY_TO_CLASS(fx_temporary,			FXTemporary);
	LINK_ENTITY_TO_CLASS(missile,				Missile);
	LINK_ENTITY_TO_CLASS(mob_bigpink,			BigPink);
	LINK_ENTITY_TO_CLASS(player,				BasePlayer);
	LINK_ENTITY_TO_CLASS(info_scroll_entity,	ScrollEntity);
	LINK_ENTITY_TO_CLASS(info_player_start,		SpawnPoint);
	LINK_ENTITY_TO_CLASS(env_ambient_sound,		EnvAmbientSound);

	//Register GameRules Classes
	GlobalVariables::GameRuleManager::Get().InstallGameRule("BasicMode", &BaseGameRule::Create);

	//Everything is fine
	return true;
}
